<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

	<ui:composition 
	  xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      template="/view/templates/templateLayout.xhtml">
      
      <ui:define name="conteudo">      	
      <link rel="stylesheet" type="text/css" href="./estilos.css"/>  
  		
<h:form id="formManterAluno" prependId="false">  
	<p:panel id="panelManterAluno" > 
		<f:facet name="header">
			<h:outputText value="Manter Aluno" styleClass="outputTextTitulo"/>
		</f:facet> 
 	<p:messages id="messagesEdit" autoUpdate="true" closable="true" /> 
    	<h:panelGrid  columns="2" style="margin-top:20px; margin-right:10%;">  
            <h:outputLabel value="Código" styleClass="outputLabel"/>  
            <h:outputLabel value="Nome do Aluno*" styleClass="outputLabel"/>             
            <p:inputText id="inputCodigo" value="#{alunoBean.alunoSave.idAluno}" styleClass="inputId" disabled="true"/>  
  			<p:inputText value="#{alunoBean.alunoSave.nome}" styleClass="inputDescricao" maxlength="40" required="true" requiredMessage="Informar o nome do Aluno!"/>  
        </h:panelGrid>  
        <h:panelGrid  columns="2" style="margin-right:10%;">  
            <h:outputLabel value="Logradouro*" styleClass="outputLabel"/>  
            <h:outputLabel value="Número*" styleClass="outputLabel"/>  
            <p:inputText value="#{alunoBean.alunoSave.logradouro}" styleClass="inputDescricao" maxlength="40" required="true" requiredMessage="Informar o logradouro!"/>  
  			<p:inputText value="#{alunoBean.alunoSave.numero}" styleClass="inputId" required="true" maxlength="10" requiredMessage="Informar o número do logradouro!"/>  
        </h:panelGrid>         
       	<h:panelGrid  columns="3" style="margin-right:10%;">  
            <h:outputLabel value="Complemento*" styleClass="outputLabel"/>  
            <h:outputLabel value="Bairro" styleClass="outputLabel"/>             
            <h:outputLabel value="CEP" styleClass="outputLabel"/>  
            <p:inputText value="#{alunoBean.alunoSave.complemento}" styleClass="inputDescricao" maxlength="40"  />  
  			<p:inputText value="#{alunoBean.alunoSave.bairro}" styleClass="inputData"  maxlength="40" />  
  			<p:inputMask mask="99.999-999" value="#{alunoBean.alunoSave.cep}" styleClass="inputData"/>  
        </h:panelGrid> 
        <h:panelGrid id="pgCidade" columns="5" style="margin-right:10%;">  
            <h:outputLabel value="Código*" styleClass="outputLabel"/>  
            <h:outputLabel value="Cidade*" styleClass="outputLabel"/>             
            <h:outputLabel /> 
            <h:outputLabel value="Estado" styleClass="outputLabel"/>             
            <h:outputLabel value="País" styleClass="outputLabel"/> 
                       
            <p:inputText value="#{alunoBean.alunoSave.cidade.idCidade}" styleClass="inputId">
            	<p:ajax  listener="#{alunoBean.onChange}" render="pgCidade" />
            </p:inputText>  
  			<p:autoComplete  value="#{alunoBean.alunoSave.cidade.descricao}" 
                    completeMethod="#{alunoBean.complete}"  >
            	<p:ajax event="itemSelect" listener="#{alunoBean.handleSelect}" update="pgCidade" />
			</p:autoComplete> 
  			<p:commandButton icon="ui-icon-search" actionListener="#{alunoBean.openDialogConsultarCidade}" immediate="true" styleClass="commandButton"  /> 
  			<p:inputText value="#{alunoBean.alunoSave.cidade.estado.sigla}" styleClass="inputId" disabled="true"/>
  			<p:inputText value="#{alunoBean.alunoSave.cidade.estado.pais.descricao}" styleClass="inputDescricao" disabled="true"/>
        </h:panelGrid> 
        <h:panelGrid  columns="5" style="margin-right:10%;">  
            <h:outputLabel value="Data de Nascimento*" styleClass="outputLabel"/>  
            <h:outputLabel value="Sexo" />  
            <h:outputLabel value="RG" styleClass="outputLabel"/>             
            <h:outputLabel value="UF" styleClass="outputLabel"/> 
            <h:outputLabel value="CPF" styleClass="outputLabel"/> 
                      
            
            <p:inputMask value="#{alunoBean.alunoSave.dtNascimento}" mask="99/99/9999" styleClass="inputData"
            				required="true" requiredMessage="Informar a 'Data de Nascimento'!">
           		<f:convertDateTime dateStyle="medium"/>
            </p:inputMask>  
            <p:selectOneMenu value="#{alunoBean.alunoSave.sexo}">
            	<f:selectItems value="#{alunoBean.arraySexo}" />
            </p:selectOneMenu> 
  			<p:inputText value="#{alunoBean.alunoSave.rg}" maxlength="40"  style="width:100px;" styleClass="inputDescricao"/> 

			<p:selectOneMenu value="#{alunoBean.alunoSave.ufRg}" >
				<f:selectItem itemLabel="UF" />
    			<f:selectItems value="#{alunoBean.listaEstado}" var="estado" itemLabel="#{estado.sigla}"/>
    			<f:converter converterId="estadoConverter"/>
			</p:selectOneMenu>

  			<p:inputMask value="#{alunoBean.alunoSave.cpf}" mask="999.999.999-99" styleClass="inputTelefone" />
        </h:panelGrid> 
        <h:panelGrid  columns="1" style="margin-right:10%;">  
            <h:outputLabel value="Profissão*" styleClass="outputLabel"/>       
  			<p:inputText value="#{alunoBean.alunoSave.profissao}" maxlength="40" styleClass="inputDescricao"/>  
        </h:panelGrid> 
        <h:panelGrid columns="1" style="text-align:center; margin-right:10%;"> 
         	<h:outputLabel value="Telefones para Contato" styleClass="outputLabel"/>      
		</h:panelGrid> 
        <h:panelGrid columns="3" style="margin-right:10%;"> 
            
            <h:outputLabel value="Residencial" styleClass="outputLabel"/>      
            <h:outputLabel value="Celular" styleClass="outputLabel"/>  
            <h:outputLabel value="Comercial" styleClass="outputLabel"/>   
            
  			<p:inputMask value="#{alunoBean.alunoSave.residencial}" mask="(99) 9999-9999" styleClass="inputTelefone"/>  
  			<p:inputMask value="#{alunoBean.alunoSave.celular}" mask="(99) 9999-9999" styleClass="inputTelefone" /> 
  			<p:inputMask value="#{alunoBean.alunoSave.telefoneComercial}" mask="(99) 9999-9999"  styleClass="inputTelefone"/> 
        </h:panelGrid> 
        <h:panelGrid  columns="1" style="text-align:center; margin-right:10%;">  
            <h:outputLabel value="E-mail" styleClass="outputLabel"/>       
  			<p:inputText value="#{alunoBean.alunoSave.email}" maxlength="40" styleClass="inputDescricao"/>  
        </h:panelGrid> 
        <h:panelGrid  columns="1" style="margin-right:10%;">  
            <h:outputLabel value="Observação" styleClass="outputLabel"/>       
  			<p:inputTextarea value="#{alunoBean.alunoSave.observacao}" rows="3" cols="100" style="font-size:14px;"/>  
        </h:panelGrid> 
    </p:panel>  
    <p:commandButton value="Salvar" actionListener="#{alunoBean.saveAluno}" update="inputCodigo, messagesEdit" style="margin-right:20px; margin-left:10px;" /> 
	<p:commandButton value="Voltar" action="#{alunoBean.consultarAluno}" style="margin-right:20px;" /> 

</h:form>  	
<ui:include src="/view/aluno/dialogConsultarCidade.xhtml"></ui:include>
</ui:define>
</ui:composition>
